using System.Data;
using System.Data.SqlClient;
using VanTaiProperty;
namespace VanTaiData
{
    public class clsTMSymbolRepairMaterialsController
    {
        private clsConnect cls = new clsConnect();

        #region[Get-Data]
        public DataTable BindGirdTMSymbolRepairMaterials()
        {
            return cls.BindGridData("sp_TMSymbolRepairMaterials");
        }
        public DataTable BindGirdTMSymbolRepairMaterials_Detail_Edit(int id)
        {
            return cls.LayDuLieuParameter("sp_TMSymbolRepairMaterials_Detail_Edit", "@SymbolRepairMaterials_ID", id);
        }
        #endregion

        #region[Insert-Update-Delete]
        public bool InsertTMSymbolRepairMaterials(clsTMSymbolRepairMaterialsProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@RepairMaterials_ID", data.RepairMaterials_ID);
            cls.AddParameter("@SymbolRepairMaterials_Alias", data.SymbolRepairMaterials_Alias);
            cls.AddParameter("@SymbolRepairMaterials_Name", data.SymbolRepairMaterials_Name);
            cls.AddParameter("@SymbolRepairMaterials_Note", data.SymbolRepairMaterials_Note);
            cls.ExecuteNonQuery("sp_TMSymbolRepairMaterials_Insert");
            return true;
        }
        public bool UpdateTMSymbolRepairMaterials(clsTMSymbolRepairMaterialsProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@SymbolRepairMaterials_ID", data.SymbolRepairMaterials_ID);
            cls.AddParameter("@RepairMaterials_ID", data.RepairMaterials_ID);
            cls.AddParameter("@SymbolRepairMaterials_Alias", data.SymbolRepairMaterials_Alias);
            cls.AddParameter("@SymbolRepairMaterials_Name", data.SymbolRepairMaterials_Name);
            cls.AddParameter("@SymbolRepairMaterials_Note", data.SymbolRepairMaterials_Note);
            cls.ExecuteNonQuery("sp_TMSymbolRepairMaterials_Update");
            return true;
        }
        public bool DeleteTMSymbolRepairMaterials(int id)
        {
            cls.Delete("sp_TMSymbolRepairMaterials_Delete", "@SymbolRepairMaterials_ID", id);
            return true;
        }
        #endregion

        #region[Search]
        public DataTable Search(string keywods)
        {
            return cls.Search("sp_TMSymbolRepairMaterials_Search", "@KEYWORDS", keywods);
        }
        #endregion
    }
}